
const Controller = require('egg').Controller;

/**
 * @controller 站内信 message
 */

class MessagesController extends Controller {
  /**
   * @apikey
   * @summary 获取 站内信
   * @description 获取 站内信
   * @request query string name message名
   * @request query number limit limit
   * @request query number offset offset
   * @router get /api/v1/messages/list
   */
  async findAll() {
    debugger
    const { ctx, service } = this;
    const { allRule, query } = ctx.helper.tools.findAllParamsDeal({
      rule: ctx.rule.messagePutBodyReq,
      queryOrigin: ctx.query,
    });
    ctx.validate(allRule, query);
    const res = await service.messages.findAll(query);
    ctx.helper.body.SUCCESS({ ctx, res });
  }

}

module.exports = MessagesController;